//
//  ZBAppManager+AppConfig.m
//  XZBProduct
//
//  Created by xzb on 2018/10/10.
//  Copyright © 2018 xzb. All rights reserved.
//

#import "ZBAppManager+AppConfig.h"
#import <ZBYAML/YAMLSerialization.h>

@implementation ZBAppManager (AppConfig)
- (void)loadingConfig
{
    kStartTime;
    NSURL *pathURL = [[NSBundle mainBundle] URLForResource:@"ZBAppConfig" withExtension:@"yaml"];
    if (pathURL.absoluteString.length < 1) {
        return;
    }
    NSData *routesData = [NSData dataWithContentsOfURL:pathURL options:NSDataReadingMappedIfSafe | NSDataReadingUncached error:nil];
    NSDictionary *cfgs =  [YAMLSerialization objectWithYAMLData:routesData options:0 error:nil];
    if (!cfgs) {
        return;
    }
    if ([cfgs.allKeys containsObject:@"launch"]) {
        self.configDict = cfgs[@"launch"];
    }
    kEnd(@"loadingConfig");
}
@end
